package com.bsgogogo.common.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 处理器拦截器的注册
 */

@Configuration
public class MyInterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 实现WebMvcConfigurer不会导致静态资源被拦截

        //完成拦截器的注册
        registry.addInterceptor(new MyInterceptor())
                .addPathPatterns("/end/page/**")  //黑名单
                .excludePathPatterns("/end/page/login.html", "/end/page/register.html"); //白名单 除了登录、注册页面
    }
}
